<!DOCTYPE html>
<html lang="en" class="no-js">

<head>

    <meta charset="utf-8">
    <title>易汉语平台登录 Login</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="">
    <!-- CSS -->
    <link rel="stylesheet" href="css/login/reset.css">
    <link rel="stylesheet" href="css/login/supersized.css">
    <link rel="stylesheet" href="css/login/style.css">
    <link rel="stylesheet" href="../../tools/toolcms/static/animate.css">


</head>

<body oncontextmenu="return false">

<div class="page-container">
    <h1>国别化（泰国）汉语教学资源库及中国文化传播平台</h1>
    <br>
    <form action="" method="post">
        <div>
            <input type="text" name="username" class="username" placeholder="请输入用户名" autocomplete="off"/>
        </div>
        <div>
            <input type="password" name="password" class="password" placeholder="请输入密码" oncontextmenu="return false"
                   onpaste="return false"/>
        </div>
        <button id="submit" type="button">登 录</button>
    </form>
    <div class="connect">
        <p>重庆西南师范大学出版社有限公司  &nbsp;&nbsp; &nbsp;&nbsp;成都乐知软件有限公司</p>
        <p style="margin-top:20px;">Chongqing Southwest Normal University Press Ltd. &nbsp;&nbsp; &nbsp;&nbsp; Chengdu lezhi soft co., ltd</p>
    </div>
</div>
<div class="alert" style="display:none">
    <h2>消息</h2>
    <div class="alert_con">
        <p id="ts"></p>
        <p style="line-height:70px"><a class="btn">确定</a></p>
    </div>
</div>
<!-- Javascript -->
<script src="js/login/jquery.min.js" type="text/javascript"></script>
<script src="js/login/supersized.3.2.7.min.js"></script>
<script src="js/login/supersized-init.js"></script>
<script type="text/javascript" src="js/jQuery.md5.js"></script>
<script type="text/javascript" src="js/config.js"></script>
<script>
    var loginApi = api.login;  //读取登录接口
    $(".btn").click(function () {
        is_hide();
    });
    var u = $("input[name=username]");
    var p = $("input[name=password]");
    $("#submit").live('click', function () {
        if (u.val() == '' || p.val() == '') {
            $("#ts").html("用户名或密码不能为空~");
            is_show();
            return false;
        }
        else {
            var user = u.val();
            var password = $.md5(p.val());

            $.ajax({
                type: 'post',
                url: loginApi,
                data: {
                    'action': 'login',
                    'username': user,
                    'password': password,
                },
                dataType: 'json',
                success: function (res) {
                    $("#ts").html(res.msg);
                    is_show();
                    if (res.code == 0) {
                        window.location.href = "choice.php";
                    }

                }, error: function (res) {
                    $("#ts").html("登录失败，请稍后再试");
                    is_show();
                    return false;
                }
            })
        }
    });
    window.onload = function () {
        $(".connect p").eq(0).animate({"left": "0%"}, 600);
        $(".connect p").eq(1).animate({"left": "0%"}, 400);
    };

    function is_hide() {
        $(".alert").animate({"top": "-40%"}, 300)
    }

    function is_show() {
        $(".alert").show().animate({"top": "45%"}, 300)
    }
</script>
</body>

</html>

